﻿using System.Windows.Input;
using VMDS.GUIClient.Helper;
using VMDS.GUIClient.ViewModels.Management.OSs;
using VMDS.GUIClient.ViewModels.Management.VMs;

namespace VMDS.GUIClient.ViewModels.Management
{
    internal class ManagementConsoleViewModel : BaseViewModel
    {
        private string _navLink;

        public ManagementConsoleViewModel()
        {
            NavigationLink = CrossWindowConnector.Pages.VmAdmHost;
            CrossWindowConnector.ManagerView = this;
        }

        public string NavigationLink
        {
            get { return _navLink; } 
            set
            {
                _navLink = value;
                OnPropertyChanged(() => NavigationLink);
                OnPropertyChanged(() => ClientsSelected);
                OnPropertyChanged(() => OsSelected);
                OnPropertyChanged(() => VmSelected);
                OnPropertyChanged(() => TaskSelected);
                OnPropertyChanged(() => SubjectsSelected);
            }
        }

        public ICommand GoToSubjects
        {
            get { return new BaseCommand(() => { NavigationLink = CrossWindowConnector.Pages.SubjectsManagement; }); }
        }

        public bool SubjectsSelected
        {
            get { return NavigationLink == CrossWindowConnector.Pages.SubjectsManagement; }
        }


        public ICommand GoToClients
        {
            get { return new BaseCommand(() => { NavigationLink = CrossWindowConnector.Pages.ClientsManagement; }); }
        }

        

        public bool ClientsSelected
        {
            get { return NavigationLink == CrossWindowConnector.Pages.ClientsManagement; }
        }

        public ICommand GoToOs
        {
            get
            {
                return new BaseCommand(() =>
                                           {
                                               OsManagementViewModel.Instance.ReInit();
                                               NavigationLink = CrossWindowConnector.Pages.OsManagement;
                                           });
            }
        }
        public bool OsSelected
        {
            get { return NavigationLink == CrossWindowConnector.Pages.OsManagement; }
        }

        
        public ICommand GoToTask
        {
            get { return new BaseCommand(() => { NavigationLink = CrossWindowConnector.Pages.TaskManagement; }); }
        }
        public bool TaskSelected
        {
            get { return NavigationLink == CrossWindowConnector.Pages.TaskManagement; }
        }


        public ICommand GoToVm
        {
            get { return new BaseCommand(() => { NavigationLink = CrossWindowConnector.Pages.VmAdmHost; }); }
        }
        public bool VmSelected
        {
            get { return NavigationLink == CrossWindowConnector.Pages.VmAdmHost; }
        }

    }
}